﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Linq.Expressions;
using System.Text;
using System.Threading.Tasks;
using Blog.IService;
using Blog.Model;
using Blog.IRepository;
using Blog.RepositoryContainer;
namespace Blog.Service
{
    public partial class AdminService : IAdminService
    {
        public IAdminRepository dal = Container.Resolve<IAdminRepository>();
        public bool Add(Admin model)
        {
            return dal.Add(model) > 0;
        }

        public bool Delete(Admin model)
        {
            return dal.Delete(model) > 0;
        }

        public List<Admin> GetModel(Expression<Func<Admin, bool>> whereExpression)
        {
            return dal.GetModel(whereExpression);
        }

        public bool Update(Admin model)
        {
            return dal.Update(model)>0;
        }
    }

    public partial class UserInfoService : IUserInfoService
    {
        public IUserInfoRepository dal = Container.Resolve<IUserInfoRepository>();
        public bool Add(UserInfo model)
        {
            return dal.Add(model) > 0;
        }

        public bool Delete(UserInfo model)
        {
            return dal.Delete(model) > 0;
        }

        public List<UserInfo> GetModel(Expression<Func<UserInfo, bool>> whereExpression)
        {
            return dal.GetModel(whereExpression);
        }

        public bool Update(UserInfo model)
        {
            return dal.Update(model) > 0;
        }
    }

    public partial class ArticleService : IArticleService
    {
        public IArticleRepository dal = Container.Resolve<IArticleRepository>();
        public bool Add(Article model)
        {
            return dal.Add(model) > 0;
        }

        public bool Delete(Article model)
        {
            return dal.Delete(model) > 0;
        }

        public List<Article> GetModel(Expression<Func<Article, bool>> whereExpression)
        {
            return dal.GetModel(whereExpression);
        }

        public bool Update(Article model)
        {
            return dal.Update(model) > 0;
        }
    }

    public partial class AttentService : IAttentService
    {
        public IAttentRepository dal = Container.Resolve<IAttentRepository>();
        public bool Add(Attent model)
        {
            return dal.Add(model) > 0;
        }

        public bool Delete(Attent model)
        {
            return dal.Delete(model) > 0;
        }

        public List<Attent> GetModel(Expression<Func<Attent, bool>> whereExpression)
        {
            return dal.GetModel(whereExpression);
        }

        public bool Update(Attent model)
        {
            return dal.Update(model) > 0;
        }
    }

    public partial class CategoryService : ICategoryService
    {
        public ICategoryRepository dal = Container.Resolve<ICategoryRepository>();
        public bool Add(Category model)
        {
            return dal.Add(model) > 0;
        }

        public bool Delete(Category model)
        {
            return dal.Delete(model) > 0;
        }

        public List<Category> GetModel(Expression<Func<Category, bool>> whereExpression)
        {
            return dal.GetModel(whereExpression);
        }

        public bool Update(Category model)
        {
            return dal.Update(model) > 0;
        }
    }

    public partial class CommentService : ICommentService
    {
        public ICommentRepository dal = Container.Resolve<ICommentRepository>();
        public bool Add(Comment model)
        {
            return dal.Add(model) > 0;
        }

        public bool Delete(Comment model)
        {
            return dal.Delete(model) > 0;
        }

        public List<Comment> GetModel(Expression<Func<Comment, bool>> whereExpression)
        {
            return dal.GetModel(whereExpression);
        }

        public bool Update(Comment model)
        {
            return dal.Update(model) > 0;
        }
    }

    public partial class ParentService : IParentService
    {
        public IParentRepository dal = Container.Resolve<IParentRepository>();
        public bool Add(Parent model)
        {
            return dal.Add(model) > 0;
        }

        public bool Delete(Parent model)
        {
            return dal.Delete(model) > 0;
        }

        public List<Parent> GetModel(Expression<Func<Parent, bool>> whereExpression)
        {
            return dal.GetModel(whereExpression);
        }

        public bool Update(Parent model)
        {
            return dal.Update(model) > 0;
        }
    }
    public partial class ProblemService : IProblemService
    {
        public IProblemRepository dal = Container.Resolve<IProblemRepository>();
        public bool Add(Problem model)
        {
            return dal.Add(model) > 0;
        }

        public bool Delete(Problem model)
        {
            return dal.Delete(model) > 0;
        }

        public List<Problem> GetModel(Expression<Func<Problem, bool>> whereExpression)
        {
            return dal.GetModel(whereExpression);
        }

        public bool Update(Problem model)
        {
            return dal.Update(model) > 0;
        }
    }

    public partial class WorkOrderService : IWorkOrderService
    {
        public IWorkOrderRepository dal = Container.Resolve<IWorkOrderRepository>();
        public bool Add(WorkOrder model)
        {
            return dal.Add(model) > 0;
        }

        public bool Delete(WorkOrder model)
        {
            return dal.Delete(model) > 0;
        }

        public List<WorkOrder> GetModel(Expression<Func<WorkOrder, bool>> whereExpression)
        {
            return dal.GetModel(whereExpression);
        }

        public bool Update(WorkOrder model)
        {
            return dal.Update(model) > 0;
        }
    }
}
